import { NextRequest, NextResponse } from 'next/server';
import { stopLiteMonitoring } from '@/lib/services-init';
import { createModuleLogger } from '@/utils/logger';

const logger = createModuleLogger('admin-monitoring-api');

export async function POST(request: NextRequest) {
  try {
    logger.info('🛑 停止链监控服务...');
    
    // 使用轻量级监控停止
    const result = await stopLiteMonitoring();
    
    return NextResponse.json({
      success: result.success,
      message: result.message,
      stoppedAt: new Date().toISOString()
    });
    
  } catch (error) {
    logger.error('❌ 停止监控失败:', error);
    return NextResponse.json(
      { 
        success: false, 
        error: '停止监控失败',
        details: error instanceof Error ? error.message : String(error)
      },
      { status: 500 }
    );
  }
} 